const fs = require('fs')
const path = require('path')
const http = require('http')

/* let pathurl = path.join(__dirname,'../files/chengji-ok.txt')
console.log(pathurl)

let app = http.createServer((req,res)=> {
    res.setHeader("Content-Type",'text/html;charset=utf-8') 
    fs.readFile(pathurl,{},(err,data) => {
        if(err) return console.log(err)
        res.write(data)
        res.end()
    })
    
})

app.listen(3000,()=> {
    console.log(' run 3000 ')
}) */


/* let pathurl = path.join(__dirname,'../files/chengji-ok.txt')

let app = http.createServer((req,res)=> {
    res.setHeader("Content-Type",'text/html;charset=utf-8') 
    fs.readFile(pathurl,'utf8',(err,data)=> {
        if(err) return console.log(err)
        res.write(data)
        res.end()
    })
}) */


let pathurl = path.join(__dirname,'../files/chengji-ok.txt')

let app = http.createServer((req,res)=> {
    res.setHeader("Content-Type",'text/html;charset=utf-8') 
    fs.readFile(pathurl,'utf8',(err,data)=> {
        if(err) return console.log(err)
        res.write(data)
        res.end()
    })
})

app.listen(3000,()=> {
    console.log('run')
})

